package com.example.springbootexamples.domain;

import java.util.Date;
import java.util.List;

public class A {

    /*// 获取一次成绩的排名 list 是以前的成绩列表，c是本次成绩
    private CheckMacroProjectKpiDay sortAndNum(List<CheckMacroProjectKpiDay> list, CheckMacroProjectKpiDay c){
        class Dire {
            private boolean b;

            public boolean isB() {
                return b;
            }

            public void setB(boolean b) {
                this.b = b;
            }
        }
        final  Dire dire=new Dire();
        list.sort(new Comparator<CheckMacroProjectKpiDay>() {
            @Override
            public int compare(CheckMacroProjectKpiDay o1, CheckMacroProjectKpiDay o2) {
                String kv=o1.getKpiName();
                //Metric metrics[]={Metric.avg_response_time,Metric.tp95_response_time,Metric.tp99_response_time,Metric.max_response_time,Metric.pmu};
                Metric metrics[]={Metric.pmu,Metric.invoke_times,Metric.max_tps,Metric.health_score};
                boolean b=false;
                for(Metric metric:metrics){
                    if(kv.equals(metric.name())){
                        b=true;
                        break;
                    }
                }
                dire.setB(b);
                Double d1=o1.getKpiValue();
                Double d2=o2.getKpiValue();
                if(b) {
                    if (d1.compareTo(d2) > 0) {
                        return -1;
                    }else if(d1.compareTo(d2)<0){
                        return 1;
                    }
                }else{
                    if (d1.compareTo(d2) < 0) {
                        return -1;
                    }else if(d1.compareTo(d2)>0){
                        return 1;
                    }
                }
                return 0;
            }
        });

        CheckMacroProjectKpiDay checkMacroProjectKpiDay=null;
        for(int i=0;i<list.size();i++){
            CheckMacroProjectKpiDay a=list.get(i);
            a.setOdr250Tradday(i+1);
            a.setScore(getScoreOfN(a.getOdr250Tradday()));  //获取排名对应的健康分
            *//*if(a.isToday()){
                checkMacroProjectKpiDay=a;
                break;
            }*//*
            if(dire.isB()){
                if(c.getKpiValue()>=a.getKpiValue()){
                    c.setOdr250Tradday(i+1);
                    break;
                }
            }else{
                if(c.getKpiValue()<=a.getKpiValue()){
                    c.setOdr250Tradday(i+1);
                    break;
                }
            }
        }
        c.setScore(getScoreOfN(c.getOdr250Tradday()));  //获取排名对应的健康分
        return checkMacroProjectKpiDay;
    }



    Integer getSortOfN(List<Integer> list,Integer N){
        list=list.sort();
        Integer sortNum=1;
        for(int i=0;i<list.size();i++){
            if(N>list.get(i)){
                sortNum=(i+1);
                break;
            }
        }
        return sortNum;
    }*/











}
